package com.demo.controller;

import com.demo.entity.Employee;
import com.demo.service.api.EmployeeRemoteService;
import com.demo.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Stone
 * @date 2020/6/16 18:59
 */
@RestController
public class FeignConsumerController {

    @Autowired
    private EmployeeRemoteService employeeRemoteService;

    /**
     * @Author:Stone

       * @return: com.demo.entity.Employee
     * @Date: 2020/6/16 19:07
     * @Description: 开启Feign客户端，并且远程调用common里面的接口。实现类在provider
    */
    @RequestMapping("/feign/consumer/get/employee/remote")
    public Employee getEmployeeByFeign(){
        return employeeRemoteService.getEmployeeRemote();
    }

    @RequestMapping("/feign/consumer/circuit/get/employee")
    public ResultEntity<Employee> getEmp(@RequestParam String keyword){
        return employeeRemoteService.getEmp(keyword);
    }
}
